import { Context } from 'egg'
export default ()=> {
    return async (ctx:Context, next:()=>Promise<any>)=>{
        try {
            await next();
        } catch (e) {
            const error = e as any;
            if(error.status === 401) {
               return ctx.helper.error({ ctx, errorType: "UserLoginValidateError" });
            }else {
                throw error
            }
            
        }
    }
}